home *** CD-ROM | disk | FTP | other *** search
- /* ShowAllMountedVolumeNames.c */
- /*
- * ShowAllMountedVolumeNames.c
- * Copyright © 1992-94 Apple Computer Inc. All Rights Reserved.
- */
-
- #include <stdio.h>
- #include <Files.h>
- #include <Devices.h>
- #ifndef FALSE
- #define FALSE 0
- #define TRUE 1
- #endif
-
- void ShowAllMountedVolumeNames(void);
- void ShowSCSIDeviceIdent(
- short driverRefNum
- );
-
- void
- ShowAllMountedVolumeNames(void)
- {
- short index;
- OSErr status;
- HVolumeParam pb;
- Str255 volumeName;
-
-
- for (status = noErr, index = 1;; index++) {
- pb.ioCompletion = NULL;
- pb.ioVolIndex = index;
- volumeName[0] = 0;
- pb.ioNamePtr = volumeName;
- pb.ioVRefNum = 0;
- status = PBHGetVInfo((HParmBlkPtr) &pb, FALSE); /* Synchronous */
- if (status != noErr)
- break;
- /*
- * Display the drive number, driver number, and volume name.
- */
- printf("Drive %2d, driver %3d, \"%.*s\"",
- (int) pb.ioVDrvInfo,
- (int) pb.ioVDRefNum,
- volumeName[0], &volumeName[1]
- );
- ShowSCSIDeviceIdent(pb.ioVDRefNum);
- printf("\n");
- }
- }
-